package com.hlw.hr_man.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hlw.hr_man.Model.EmployeeModel;
import com.hlw.hr_man.service.EmployeeSrevice;
import com.hlw.hr_man.serviceImpl.EmployeeServiceImpl;
/**
 * 个人中心信息修改
 * @author李豪
 *
 */
public class Upmyinfocontroller extends HttpServlet {
	EmployeeSrevice employeeservice=new EmployeeServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		PrintWriter pw=resp.getWriter();
		String e_number=req.getParameter("e_number");
		String e_address=req.getParameter("e_address");
		int e_age=Integer.parseInt(req.getParameter("e_age"));
		String e_birthday=req.getParameter("e_birthday");
		String e_description=req.getParameter("e_description");
		String e_email=req.getParameter("e_email");
		String e_sex=req.getParameter("e_sex");
		String e_tel=req.getParameter("e_tel");
		EmployeeModel employee=new EmployeeModel();
		employee.setE_number(e_number);
		employee.setE_address(e_address);
		employee.setE_email(e_email);
		employee.setE_birthday(e_birthday);
		employee.setE_age(e_age);
		employee.setE_description(e_description);
		employee.setE_sex(e_sex);
		employee.setE_tel(e_tel);
		int i=employeeservice.updateMyInfo(employee);
		if(i==1){
			pw.write("1");
		}
		else{
			pw.write("0");
		}
	}

}
